<%-- 
    Document   : index
    Created on : May 4, 2012, 3:18:13 AM
    Author     : Haridwar
--%>

<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@include file="header.jsp" %>
<script>
$(document).ready(function(){

    $('#state').change(function(e){
        $this = $(e.target);
        
        $.ajax({
            type: "POST",
            url: "src/loadcity.jsp", 
            data: "state="+$this.val(),
            success:function(data){
                $('#city').html(data);
            }
        });
    });

});
</script>



<%try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobportal", "root", "root");
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("select distinct state from dist");
%>
<select id="state" name="state">
    <%
        while (rs.next()) {
            out.println("<option value=\"" + rs.getString(1) + "\">" + rs.getString(1) + "</option>");
        }
    %>
</select>
<select id="city" name="city">
    
    <option >Select</option>
</select>
<%}catch(Exception e){
    
 out.println(e);   
}
%>